package com.run2code;

// Definition for a Node.
class Node {
    int val;
    Node next, random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }

    public String print(Node node) {
        if (node != null) {
            return node.val + "(random:" + (node.random != null ? node.random.val + "" : "null") + ")" + "->" + print(node.next);
        }
        return "null";
    }


}